import 'package:flutter/material.dart';
import 'package:edu/constants/app_strings.dart';

class IdentityVerificationPage extends StatefulWidget {
  const IdentityVerificationPage({super.key});

  @override
  State<IdentityVerificationPage> createState() =>
      _IdentityVerificationPageState();
}

class _IdentityVerificationPageState extends State<IdentityVerificationPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text(AppStrings.identityVerification)),
      body: _buildMainBody(context),
    );
  }

  Widget _buildMainBody(BuildContext context) {
    const color = Colors.grey;
    return SafeArea(
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 10),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const SizedBox(height: 20),
            Row(
              children: [
                const Spacer(),
                const Icon(Icons.error, color: color, size: 24),
                const SizedBox(width: 10),
                Text(
                  AppStrings.notVerified,
                  style: Theme.of(
                    context,
                  ).textTheme.titleLarge?.copyWith(color: color),
                ),
                const Spacer(),
              ],
            ),
            const SizedBox(height: 30),
            Text(
              AppStrings.identityVerificationTipTitle,
              style: Theme.of(context).textTheme.titleMedium,
            ),
            const SizedBox(height: 5),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 15),
              child: _buildIDVerifyNoteTexts(context),
            ),
            const SizedBox(height: 30),
            _buildMainButtonRow(context),
          ],
        ),
      ),
    );
  }

  Widget _buildMainButtonRow(BuildContext context) {
    return Container(
      height: 44,
      width: double.infinity,
      padding: const EdgeInsets.symmetric(horizontal: 20),
      child: ElevatedButton(
        onPressed: _mainButtonPressed,
        style: ButtonStyle(
          shape: WidgetStateProperty.all<RoundedRectangleBorder>(
            RoundedRectangleBorder(borderRadius: BorderRadius.circular(6.0)),
          ),
        ),
        child: Text(
          AppStrings.verify,
          style: Theme.of(context).textTheme.titleMedium,
        ),
      ),
    );
  }

  void _mainButtonPressed() {}

  Widget _buildIDVerifyNoteTexts(BuildContext context) {
    const color = Colors.grey;
    final style = Theme.of(context).textTheme.bodySmall?.copyWith(color: color);
    final lines = AppStrings.identityVerificationTip.split('\n');
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: lines.map((e) {
        return Column(
          children: [
            Text(e, style: style),
            const SizedBox(height: 10),
          ],
        );
      }).toList(),
    );
  }
}
